home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / x11 / strategy / xpuzzles.3 / xpuzzles / xpuzzles-5.3.1 / xmball / MballP.h < prev    next >
C/C++ Source or Header  |  1996-03-03  |  4KB  |  152 lines

  1. /*
  2. # X-BASED MASTERBALL(tm)
  3. #
  4. #  MballP.h
  5. #
  6. ###
  7. #
  8. #  Copyright (c) 1994 - 96    David Albert Bagley, bagleyd@hertz.njit.edu
  9. #
  10. #                   All Rights Reserved
  11. #
  12. #  Permission to use, copy, modify, and distribute this software and
  13. #  its documentation for any purpose and without fee is hereby granted,
  14. #  provided that the above copyright notice appear in all copies and
  15. #  that both that copyright notice and this permission notice appear in
  16. #  supporting documentation, and that the name of the author not be
  17. #  used in advertising or publicity pertaining to distribution of the
  18. #  software without specific, written prior permission.
  19. #
  20. #  This program is distributed in the hope that it will be "playable",
  21. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  23. #
  24. */
  25.  
  26. /* Private header file for Mball */
  27.  
  28. #ifndef _MballP_h
  29. #define _MballP_h
  30.  
  31. #include "Mball.h"
  32.  
  33. /*** random number generator ***/
  34. /* insert your favorite */
  35. extern void SetRNG();
  36. extern long LongRNG();
  37. #define SRAND(X) SetRNG((long) X)
  38. #define LRAND() LongRNG()
  39.  
  40. #define NRAND(X) ((int)(LRAND()%(X)))
  41.  
  42. #define SYMBOL ':'
  43.  
  44. #define TOP 0
  45. #define TR 1
  46. #define RIGHT 2
  47. #define BR 3
  48. #define BOTTOM 4
  49. #define BL 5
  50. #define LEFT 6
  51. #define TL 7
  52. #define COORD 8
  53. #define CW 9
  54. #define CCW 15
  55. #define CUTS (COORD / 2)
  56.  
  57. /* The following are in xmball.c also */
  58. #define MINWEDGES 2
  59. #define MAXWEDGES 8
  60. #define MINRINGS 1
  61.  
  62. #define DEFAULTWEDGES 8
  63. #define DEFAULTRINGS 4
  64. #define SAME 0
  65. #define OPPOSITE 1
  66. #define DOWN 0
  67. #define UP 1
  68. #define MAXVIEWS 2
  69.  
  70. #define NUM_DEGREES 360
  71. #define ST_ANG  (NUM_DEGREES/2)
  72. #define RT_ANG  (NUM_DEGREES/4)
  73. #define DEGREES(x) ((x)/M_PI*(double)ST_ANG)
  74. #define RADIANS(x) (M_PI*(x)/(double)ST_ANG)
  75. #define MULT 64
  76. #define CIRCLE (NUM_DEGREES*MULT)
  77. #define CIRCLE_2  (CIRCLE/2)
  78. #define CIRCLE_4  (CIRCLE/4)
  79.  
  80. #define ABS(a) (((a)<0)?(-a):(a))
  81. #define SIGN(a) (((a)<0)?(-1):1)
  82. #define MIN(a,b) (((int)(a)<(int)(b))?(int)(a):(int)(b))
  83. #define MAX(a,b) (((int)(a)>(int)(b))?(int)(a):(int)(b))
  84.  
  85. typedef struct _MballLoc
  86. {
  87.   int wedge, direction;
  88. } MballLoc;
  89.  
  90. typedef struct _MballPart
  91. {
  92.   Pixel foreground;
  93.   Pixel borderColor;
  94.   Pixel wedgeColor[MAXWEDGES];
  95.   MballLoc *mballLoc[MAXWEDGES];
  96.   int currentWedge, currentRing;
  97.   Boolean started, practice, orient, vertical, mono;
  98.   int depth;
  99.   int wedges, rings;
  100.   Position delta, dr;
  101.   Position mballLength;
  102.   Position wedgeLength;
  103.   Position viewLength, viewMiddle;
  104.   XPoint puzzleSize;
  105.   XPoint puzzleOffset, letterOffset;
  106.   GC puzzleGC;
  107.   GC borderGC;
  108.   GC wedgeGC[MAXWEDGES];
  109.   GC inverseGC;
  110.   String wedgeName[MAXWEDGES];
  111.   XtCallbackList select;
  112. } MballPart;
  113.  
  114. typedef struct _MballRec
  115. {
  116.   CorePart core;
  117.   MballPart mball;
  118. } MballRec;
  119.  
  120. /* This gets around C's inability to do inheritance */
  121. typedef struct _MballClassPart
  122. {
  123.   int ignore;
  124. } MballClassPart;
  125.  
  126. typedef struct _MballClassRec
  127. {
  128.   CoreClassPart core_class;
  129.   MballClassPart mball_class;
  130. } MballClassRec;
  131.  
  132. extern MballClassRec mballClassRec;
  133. extern MballLoc *startLoc[MAXWEDGES];
  134.  
  135. extern void MoveMball();
  136. /*extern void SolveWedges();*/ /* For future auto-solver */
  137. extern void DrawAllWedges();
  138. extern Boolean CheckSolved();
  139. extern void InitMoves();
  140. extern void PutMove();
  141. extern void GetMove();
  142. extern int MadeMoves();
  143. extern void FlushMoves();
  144. extern int NumMoves();
  145. extern void ScanMoves();
  146. extern void PrintMoves();
  147. extern void ScanStartPosition();
  148. extern void PrintStartPosition();
  149. extern void SetStartPosition();
  150.  
  151. #endif /* _MballP_h */
  152.